package com.yyp.dao.impl;

import java.io.Serializable;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yyp.bean.PublicClass;
import com.yyp.dao.BaseDao;
import com.yyp.dao.CarInfoDao;
import com.yyp.dao.PublicClassDao;

@Service
@Transactional
public class PublicClassDaoImpl implements PublicClassDao {
	@Resource
	BaseDao baseDaoImpl;

	
	public void delete(Serializable names) {
		baseDaoImpl.delete(PublicClass.class, this.find((String) names)
				.getIpId());
	}

	
	public void delete(Integer id) {
		baseDaoImpl.delete(PublicClass.class, id);
	}

	
	public PublicClass find(Integer id) {
		return baseDaoImpl.find(PublicClass.class, id);
	}

	
	public PublicClass find(String name) {
		String sql = "from PublicClass as p where p.icWaterAccount=?";
		String params[] = { name };
		return baseDaoImpl.find(sql, params);
	}

	
	public void save(Object entity) {
		baseDaoImpl.save(entity);
	}


	public List<PublicClass> findAll() {
		String sql = "from PublicClass";
		return baseDaoImpl.findAll(sql);
	}


	public void updata(Object entity) {

		baseDaoImpl.updata(entity);
	}

}
